package org.easy.struts.convert;

import org.apache.commons.beanutils.Converter;

public class SqlDateConvert implements Converter {
	@Override
	public Object convert(@SuppressWarnings("rawtypes") Class cls, Object value)  {
		if (value == null || "".equals(value)) {
			return  new java.sql.Date(new java.util.Date().getTime()) ;
		}
		
		if (value instanceof java.sql.Date) {
			return value;
		}
		
		java.sql.Date d = null;
		if (value instanceof String) {
			d =  java.sql.Date.valueOf((String) value);
		}
		return d;
	}
}
